#include"ground_data.h"

GroundData* GroundData_ = NULL;

GroundData::GroundData(int cell_q_y, float min_size_x, float depth, float width) {
  int i = 0;
  float a = 0.0f;
  float next_size = min_size_x;
  this->cell_q_y = cell_q_y;
  this->depth = depth;
  while(1) {
    a += next_size;
    next_size = next_size * 1.5f; 
    i++;
    if(a >= width)
      break;
  }
  cell_q_x = i;
  this->width = a;
  delta_x = new float[cell_q_x];
  next_size = min_size_x;
  for(int i=0; i<cell_q_x; i++){
    delta_x[i] = next_size;
    next_size = next_size * 1.5f; 
    //printf("delta_x = %f\n", delta_x[i]);
  }

  T = new float*[cell_q_x];
  for(int i=0; i<cell_q_x; i++)
    T[i] = new float[cell_q_y];
  
  delta_y = depth/(float)cell_q_y;
  //printf("delta_y = %f\n", delta_y);
  return;
}